<?php

class QuestionComponents {
	
	public static function getQuestionList($params) {
		$html = '';
		if (isset($params['categoryId'])) {
			$questions = db::getInstance()->performQuery('`categoryId`=:categoryId `status`!=:notVisible', array('categoryId' => $params['categoryId'], 'notVisible' => oeQuestion::QUESTION_STATUS_ARCHIEVED));
			if (!empty($questions)) {
				foreach ($questions as $key => $question) {
					$html .= '<a href="/question/edit?id='. $question->getId() .'">'. $question->getName() .'</a>';
				}	
			}
			else {
				$html .= '<p>This category has no question</p>';
			}
		}
		$html .= '<a href="/question/edit?categoryId='. $params['categoryId'] .'">add question</a>';
		return $html;
	}
	
	
	
	
}
